import { createSlice, createAsyncThunk } from "@reduxjs/toolkit";
import {findById} from '../services/student';
export const fetchStudent = createAsyncThunk(
    "student/fetchStudent",
    async (id) => {
        let data = await findById(id);
        console.log("Data",data);
        return data;
    }
);

const studentSlice = createSlice({
    name: "student",
    initialState: {
        student: {name:"xz"},
    },
    reducers: {},
    extraReducers(builder) {
        builder.addCase(fetchStudent.fulfilled, (state, action) => {
            state.student = action.payload;
        });
    },
});
// export const {} = testSlice.actions;
export default studentSlice.reducer;
